package com.class06.advice;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Aspect
@Component
@Order(10) // 数值越小，优先级越高
public class TestA {
//    超前

    @Before("execution(* com..HelloService.*(..))")
    public void pre() {
        System.out.println("A前置通知");
    }

    @AfterReturning(value = "execution(* com..HelloService.*(..))", returning = "result")
    public void afterReturning(String result) {
        System.out.println("返回值是：" + result);
        System.out.println("A返回通知");
    }

    @After("execution(* com..HelloService.*(..))")
    public void after() {
        System.out.println("A后置通知");
    }
}
